<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>三行情诗 - 会员中心 - 好诗文</title>
    <link href="__ROOT__/shiwen/pc/xin/css/manage.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="__ROOT__/shiwen/pc/xin/css/sweetalert.css">
    <style>
        .subject,.content,.submit{border-radius: 3px;}
        .subject{width:610px; padding:7px; border:1px solid #ccc; height:25px; font-size:24px;}
        .content{ width:610px; padding:7px; border:1px solid #ccc; height:300px; overflow:auto;}
        .submit{padding:8px 20px; font-weight:bold; color:#fff; background:#ff8800; border:none;}

        .frmarea{padding:15px 10px}
        em{ font-style:normal;}
        small{color:#999;margin-left:5px;}
        .item{margin:5px 0 10px;}
        .category{border:1px solid #eee; padding:5px 0; width:624px;}
    </style>
</head>
<body>
<div class="wrapper">
    {include file="pc/member/header" /}
    <div id="content">
        <div id="postarticle">
            <h2><span></span>编写三行情诗</h2>
            <input type="hidden" value="{$list.id|default=''}" name="id" id="id"/>
            <div class="frmarea">
                    <div class="item"><h3><em>第一行</em><small>(必填)</small></h3><input type="text" name="one" class="one" value="{$list.one|default=''}" /></div>
                    <div class="item"><h3><em>第二行</em><small>(必填)</small></h3><input type="text" name="two" class="two" value="{$list.two|default=''}" /></div>
                    <div class="item"><h3><em>第三行</em><small>(必填)</small></h3><input type="text" name="three" class="three" value="{$list.three|default=''}" /></div>

<!--                    <div class="item"><h3><em>配图</em><small>(选填)</small></h3><input name="pic" type="file" id="pic" /></div>-->
                    <div class="item">
                        <input type="submit" class="submit" id="btnsubmit" value="提 交" />
                        &nbsp;&nbsp;&nbsp;
                        <input type="checkbox" name="zhuan" value="1" checked="checked" />我保证本文是我的原创作品
                    </div>
                    <input type="hidden" name="tupian" id="tupian" value="" />
            </div>
        </div>
    </div>
    <div id="footer">&copy;2006-<?php echo date('Y'); ?> www.okshiwen.cn</div>
</div>
<script type="text/javascript" src="__ROOT__/static/plugs/jquery/jquery.min.js"></script>
<script src="__ROOT__/shiwen/pc/xin/js/sweetalert.min.js"></script>

<script type="text/javascript" src="__ROOT__/shiwen/pc/xin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__ROOT__/shiwen/pc/xin/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="__ROOT__/shiwen/pc/xin/ueditor/lang/zh-cn/zh-cn.js"></script>
<script>
    $(function(){
        $('#btnsubmit').click(function(){
            var id = $("#id").val();
            var one=$(".one").val();
            var two=$(".two").val();
            var three=$(".three").val();
            // var pic=$("#pic").val();
            // $("#tupian").val(pic);
            if(one==''){
                swal("OMG!", "客官，这家伙第一行不要了!!!", "error");
                return false;
            }
            if(two==''){
                swal("OMG!", "客官，这家伙第二行不填了!!!", "error");
                return false;
            }
            if(three==''){
                swal("OMG!", "客官，这家伙第三行逃跑了!!!", "error");
                return false;
            }
            $(this).attr('disabled',true).val('正在提交，请稍后').css({'color':'#666','background':'#eee'});
            $.ajax({
                url: '/loveSave',
                type: 'POST',
                dataType: 'json',
                data: {
                    'id': id,
                    'one': one,
                    'two': two,
                    'three': three
                },
                success: function(res) {
                    if (res.code == 200) {
                        swal("Good!", res.msg, "success");
                        setTimeout(function(){
                            window.location.href = "/loveList.html";
                        },1000);
                    } else {
                        swal("OMG!", res.msg, "error");
                        $('#btnsubmit').attr('disabled', false).val('发 布').css({
                            'color': '#fff',
                            'background': '#ff8800'
                        });
                    }
                },
                error: function(xhr, status, error) {

                }
            });

        });
    });
</script>
</body>
</html>